import type { SourceCodeTransformerEnforce } from "@unocss/core";
import { createContext } from "./context";
import { applyTransformers } from "./transformers";

export const transformedCode = async (
  code: string,
  id: string = "temp.css",
  enforce: SourceCodeTransformerEnforce = "default"
) => {
  const ctx = createContext();
  const transformer = await applyTransformers(ctx, code, id, enforce);
  return transformer?.code;
};
